// rcc 快速生成React组件的骨架

import React, { Component } from "react";

import FetchUser from "../FetchUser";

export default class FetchUserBtn extends Component {
  state = {
    id: 9527,
  };

  onIdChange = () => {
    this.setState({id: this.state.id + 1});
  };

  onGetUser = (user) => {
    // console.log("user", user);
    this.setState({ user });
  }

  render() {
    const { id, user } = this.state;
    return (
      <div>
        <button onClick={this.onIdChange}>Change User {id}</button>
        <FetchUser id={id} user={user}  onGetUser={this.onGetUser} />
      </div>
    );
  }
}
